// 引入一级路由组件
import Home from "../pages/Home";
import Search from "../pages/Search";
import Login from "../pages/Login";
import Register from "../pages/Register";
import Detail from "../pages/Detail";
import AddCartSuccess from "../pages/AddCartSuccess";
import ShopCart from "../pages/ShopCart";
import Trade from "../pages/Trade";
import Pay from "../pages/Pay";
import PaySuccess from "../pages/PaySuccess";
import Center from "../pages/Center";
// 引入二级路由组件
import MyOrder from "../pages/Center/myOrder";
import GroupBuy from "../pages/Center/groupOrder";
// 配置路由
export default [
  {
    path: "/center",
    component: Center,
    meta: {
      show: true,
      title: "个人中心",
    },
    name: "Center",
    children: [
      {
        path: "myorder",
        component: MyOrder,
      },
      {
        path: "groupbuy",
        component: GroupBuy,
      },

      {
        path: "",
        redirect: "myorder",
      },
    ],
  },
  {
    path: "/paySuccess",
    component: PaySuccess,
    meta: {
      show: true,
      title: "支付成功！",
    },
    name: "PaySuccess",
  },
  {
    path: "/pay",
    component: Pay,
    meta: {
      show: true,
      title: "支付",
    },
    name: "Pay",
  },
  {
    path: "/trade",
    component: Trade,
    meta: {
      show: true,
      title: "结算",
    },
    name: "Trade",
  },
  {
    path: "/shopCart",
    component: ShopCart,
    meta: {
      show: true,
      title: "购物车",
    },
    name: "ShopCart",
  },
  {
    path: "/addCartSuccess",
    component: AddCartSuccess,
    meta: {
      show: true,
      title: "购物车--添加商品成功",
    },
    name: "Addcartsuccess",
  },
  {
    path: "/detail/:skuId",
    component: Detail,
    meta: {
      show: true,
      title: "商品详情",
    },
  },
  {
    path: "/home",
    component: Home,
    meta: {
      show: true,
      title: "尚品汇",
    },
  },
  {
    path: "/search/:keyword?",
    component: Search,
    meta: {
      show: true,
      title: "商品搜索",
    },
    name: "Search",
  },
  {
    path: "/login",
    component: Login,
    meta: {
      show: false,
      title: "登录",
    },
  },
  {
    path: "/register",
    component: Register,
    meta: {
      show: false,
      title: "注册",
    },
  },
  // 重定向,访问/时立马定向到首页
  {
    path: "/",
    redirect: "/home",
  },
];
